package jeju.daum.controller;

import java.util.List;
import jeju.daum.model.Comment;
import jeju.daum.model.User;
import jeju.daum.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.support.SessionStatus;

@Controller
public class CommentController {
	
	@Autowired CommentService commentService;

	@RequestMapping(value="/comment", method=RequestMethod.GET)
	public List<Comment> showGetComment(@ModelAttribute("user") User user, SessionStatus session){
		
		return commentService.getCommentList();
	}
	
	@RequestMapping(value="/comment", method=RequestMethod.POST)
	public List<Comment> showPostAction(@ModelAttribute("user") User user, SessionStatus session){
		
		System.out.println(user.getId());
		return commentService.getCommentList();
	}
}
